<!DOCTYPE html>
 <html>
 <head>
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 <% include("/WEB-INF/view/console/common/css.html"){}	%>
 <% include("/WEB-INF/view/console/common/js.html"){} 	%>
 <title></title>
 </head>
 <body> <nav class="navbar navbar-default navbar-fixed-top site-navbar" >
  <div class="navbar-header">
 <a class="navbar-brand" href="#">sysNav</a>
 </div>
  </nav>
 <form name="sysNav_form"  id="sysNav_form" class="form-horizontal" style="margin-top: 60px;">
   <div class="form-group" >
 <label class="col-sm-2 control-label">菜单名称</label>
 <div class="col-sm-6">
 <input  type="text"  name="name" id="name" class="form-control" check-type="required" value='${sysNav.name!}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">菜单地址</label>
 <div class="col-sm-6">
 <input  type="text"  name="url" id="url" class="form-control" check-type="required" value='${sysNav.url!}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">链接打开位置</label>
 <div class="col-sm-6">
 <input  type="text"  name="urlTarget" id="urlTarget" class="form-control" check-type="required" value='${sysNav.urlTarget!}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">排序</label>
 <div class="col-sm-6">
 <input  type="text"  name="sort" id="sort" class="form-control" check-type="required" value='${sysNav.sort!}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">状态</label>
 <div class="col-sm-6">
 <label><input checked='checked' auto_name='sysNav_status' type="radio"  name="status" value="1"/>可用</label>
 <label><input  auto_name='sysNav_status' type="radio"  name="status" value="0"/>不可用</label>
  
 </div>
  </div>
 	<script type="text/javascript">
       $(function($){
       $('input[auto_name="sysNav_status"]').each(function(){
       if('${sysNav.status!}'==this.value){ 
             $(this).attr('checked','checked');
            }
           });
 	    });
 	</script> 
 <div class="form-group" >
 <label class="col-sm-2 control-label">是否显示</label>
 <div class="col-sm-6">
 <label><input checked='checked' auto_name='sysNav_isShow' type="radio"  name="isShow" value="1"/>是</label>
 <label><input  auto_name='sysNav_isShow' type="radio"  name="isShow" value="0"/>否</label>
  
 </div>
  </div>
 	<script type="text/javascript">
       $(function($){
       $('input[auto_name="sysNav_isShow"]').each(function(){
       if('${sysNav.isShow!}'==this.value){ 
             $(this).attr('checked','checked');
            }
           });
 	    });
 	</script> 
  <div class="form-group" >
 <label class="col-sm-2 control-label">菜单图标</label>
 <div class="col-sm-3">
   <span class="btn btn-success fileinput-button">
        <i class="glyphicon glyphicon-plus"></i>
        <span>添加</span>
  <input type="file" id="iconUrl_file" class="form-control" value='${sysNav.iconUrl!}' >
  <input type="hidden" id="iconUrl"  name="iconUrl"class="form-control" value='${sysNav.iconUrl!}' >
    </span>
  <div id="iconUrl_progress" class="progress">
   <div class="progress-bar progress-bar-success"></div>
  </div>
  </div>
   	<div class="col-sm-4">
   	<img id="iconUrl_file_show" src="${sysNav.iconUrl!}" style="width:100px;" alt="图片" class="img-rounded">
 </div>
 </div>

   <script type="text/javascript"> 
 $(function($){  
  consoleUploadImg('iconUrl','${ctxPath}');
 });
 </script>
     <input  type="hidden"  name="level" id="level" class="form-control" value='${sysNav.level!1}' >
     <input  type="hidden"  name="pId" id="pId" class="form-control" value='${sysNav.pId!0}' >
     <input type='hidden' name='navId' id='navId' value='${sysNav.navId!}'><input type='hidden' name='common_token' id='common_token' value='${common_token!}'>
 <div class="form-group" style="margin-bottom: 60px;"></div>
 </form>
 <script type="text/javascript">
 $(function($) {
    /*开启表单验证*/
 	$("#sysNav_form").validation();
 });
 /*保存*/
 function saveZqForm(){
    if ($("#sysNav_form").valid() == false) {
 	    return false;
    }
    var formObject=new Object();
    formObject.name=$('#name').val()==''?null:$('#name').val(); 
 formObject.url=$('#url').val()==''?null:$('#url').val(); 
 formObject.urlTarget=$('#urlTarget').val()==''?null:$('#urlTarget').val(); 
 formObject.iconUrl=$('#iconUrl').val()==''?null:$('#iconUrl').val(); 
 formObject.sort=$('#sort').val()==''?null:$('#sort').val(); 
 formObject.pId=$('#pId').val()==''?null:$('#pId').val(); 
 formObject.level=$('#level').val()==''?null:$('#level').val();
     formObject.status=($('input[name="status"]:checked').val()==''?null:$('input[name="status"]:checked').val());
     formObject.isShow=($('input[name="isShow"]:checked').val()==''?null:$('input[name="isShow"]:checked').val());
 formObject.navId=$('#navId').val()==''?null:$('#navId').val(); 
 
    var formObjectJson = JSON.stringify(formObject);
    $.post("${ctxPath}/console/sys_nav/save",
     {
           formObjectJson :formObjectJson,
 	   table_name :'sysNav',
 	   common_token :$("#common_token").val()
     }, function(data) {
          $.alert({
 	      title: '提示',
 	      content:data.message,
 	      backgroundDismiss: false,
 	      confirmButton:"确定",
 	      autoClose: 'confirm|2000',
 		  confirm: function(){
            parent.$('#sysNav').bootgrid('reload');
            parent.art.dialog.get('id-dialog-sysNav').close();
 		  }
 		});
     });
 }
 </script>
 <nav class="navbar navbar-default navbar-fixed-bottom site-navbar" >
 <div class="container" style="padding-top:10px;padding-bottom:10px;">
 <div class="nav navbar-nav navbar-right">
 <a href="#" class="btn btn-success"  onclick='saveZqForm()'>保存 </a>
  </div>
  </div>
  </nav>
 </body>
